package com.home.homepage.controller.link;

import com.eig.common.entity.homepageentity.link.TbLink;
import com.eig.common.vo.Result;
import com.home.homepage.service.link.LinkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：YQ袁（2446806940@qq.com）
 * @date ：Created in 2022/12/23 17:01
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/link/")
@Api(value = "友情链接管理")
public class LinkController {
    @Autowired
    private LinkService linkService;
    @PostMapping("/getAllLink/{currentPage}/{pageSize}")
    @ApiOperation(value = "分页接口",notes = "currentPage,pageSize")
    public Result getAllLink(
            @PathVariable Integer currentPage,
            @PathVariable Integer pageSize,
            @RequestBody TbLink TbLink
    ){
       return linkService.getAllLink(currentPage,pageSize,TbLink);
    }
    @PostMapping("/changeStatus/{linkId}/{isDisable}")
    @ApiOperation(value = "修改状态",notes = "根据linkId修改isDisable")
    public Result changeStatus(
            @PathVariable String linkId,
            @PathVariable String isDisable
    ){
       return    linkService.changeStatus(linkId,isDisable);
    }
    @PostMapping("/deleteLink")
    @ApiOperation(value = "删除")
    public Result deleteLink(@RequestBody TbLink tbLink){
        return linkService.deleteLink(tbLink);
    }
    @PostMapping("/addLink")
    @ApiOperation(value = "添加")
    public Result addLink(@RequestBody TbLink tbLink){
        return linkService.addLink(tbLink);
    }
    @PostMapping("/updateLink")
    @ApiOperation(value = "修改")
    public Result updateLink(@RequestBody TbLink tbLink){
        return linkService.updateLink(tbLink);
    }


}
